home *** CD-ROM | disk | FTP | other *** search
/ Apple WWDC 1996 / WWDC96_1996 (CD).toast / Technology Materials / MacOS 8 Resources / Developer Tools / Mac OS 8 Interfaces & Libraries / Interfaces / PInterfaces / PCCardTuples.p < prev    next >
Text File  |  1996-05-01  |  14KB  |  446 lines

  1. {
  2.      File:        PCCardTuples.p
  3.  
  4.      Contains:    List of PCMCIA tuple types and definitions of tuple contents.
  5.  
  6.      Version:    Technology:    System 7.5
  7.                  Release:    Universal Interfaces 3.0d3 on Copland DR1
  8.  
  9.      Copyright:    © 1984-1996 by Apple Computer, Inc.  All rights reserved.
  10.  
  11.      Bugs?:        If you find a problem with this file, send the file and version
  12.                  information (from above) and the problem description to:
  13.  
  14.                      Internet:    apple.bugs@applelink.apple.com
  15.                      AppleLink:    APPLE.BUGS
  16.  
  17. }
  18. {$IFC UNDEFINED UsingIncludes}
  19. {$SETC UsingIncludes := 0}
  20. {$ENDC}
  21.  
  22. {$IFC NOT UsingIncludes}
  23.  UNIT PCCardTuples;
  24.  INTERFACE
  25. {$ENDC}
  26.  
  27. {$IFC UNDEFINED __PCCARDTUPLES__}
  28. {$SETC __PCCARDTUPLES__ := 1}
  29.  
  30. {$I+}
  31. {$SETC PCCardTuplesIncludes := UsingIncludes}
  32. {$SETC UsingIncludes := 1}
  33.  
  34. {$IFC UNDEFINED __TYPES__}
  35. {$I Types.p}
  36. {$ENDC}
  37.  
  38. {$PUSH}
  39. {$ALIGN MAC68K}
  40. {$LibExport+}
  41.  
  42.  
  43. CONST
  44.     MAX_TUPLE_SIZE                = 256;
  45.  
  46. {
  47. ------------------------------------------------------------------------------------------------------------------------------------------------
  48.     Defines for Tuple codes
  49. ------------------------------------------------------------------------------------------------------------------------------------------------
  50. }
  51.     CISTPL_NULL                    = $00;
  52.     CISTPL_DEVICE                = $01;
  53.     CISTPL_LONGLINK_MFC            = $06;
  54.     CISTPL_CHECKSUM                = $10;
  55.     CISTPL_LONGLINK_A            = $11;
  56.     CISTPL_LONGLINK_C            = $12;
  57.     CISTPL_LINKTARGET            = $13;
  58.     CISTPL_NO_LINK                = $14;
  59.     CISTPL_VERS_1                = $15;
  60.     CISTPL_ALTSTR                = $16;
  61.     CISTPL_DEVICE_A                = $17;
  62.     CISTPL_JEDEC_C                = $18;
  63.     CISTPL_JEDEC_A                = $19;
  64.     CISTPL_CONFIG                = $1A;
  65.     CISTPL_CFTABLE_ENTRY        = $1B;
  66.     CISTPL_DEVICE_OC            = $1C;
  67.     CISTPL_DEVICE_OA            = $1D;
  68.     CISTPL_DEVICE_GEO            = $1E;
  69.     CISTPL_DEVICE_GEO_A            = $1F;
  70.     CISTPL_MANFID                = $20;
  71.     CISTPL_FUNCID                = $21;
  72.     CISTPL_FUNCE                = $22;
  73.     CISTPL_SWIL                    = $23;
  74.     CISTPL_VERS_2                = $40;
  75.     CISTPL_FORMAT                = $41;
  76.     CISTPL_GEOMETRY                = $42;
  77.     CISTPL_BYTEORDER            = $43;
  78.     CISTPL_DATE                    = $44;
  79.     CISTPL_BATTERY                = $45;
  80.     CISTPL_ORG                    = $46;
  81.     CISTPL_VENDOR                = $FE;
  82.     CISTPL_END                    = $FF;
  83.  
  84. {
  85. ------------------------------------------------------------------------------------------------------------------------------------------------
  86.     Tuple Data Block Definitions
  87. ------------------------------------------------------------------------------------------------------------------------------------------------
  88. }
  89. { ------------    Device Information Tuple (01H, 17H)    -----------                             }
  90.  
  91. TYPE
  92.     DeviceIDTuplePtr = ^DeviceIDTuple;
  93.     DeviceIDTuple = RECORD
  94.         TPLDEV_TYPE_WPS_SPEED:    SInt8;                                    {  Device Type Code: 7-4, WPS: 3,  Device Speed: 2-0 }
  95.         deviceData:                PACKED ARRAY [0..252] OF Byte;
  96.     END;
  97.  
  98.  
  99. CONST
  100.     TPLDEV_TYPE_MASK            = $F0;                            {  device type mask for TPLDEV_TYPE_WPS_SPEED }
  101.     TPLDEV_TYPE_EXTENDED        = $E0;                            {  device type value for extended type }
  102.     TPLDEV_WPS_MASK                = $08;                            {  write-protect switch mask for TPLDEV_TYPE_WPS_SPEED }
  103.     TPLDEV_SPEED_MASK            = $07;                            {  device speed mask for TPLDEV_TYPE_WPS_SPEED }
  104.     TPLDEV_DSPEED_NULL            = $00;                            {  speed for null device type }
  105.     TPLDEV_DSPEED_250NS            = $01;                            {  250ns card access time }
  106.     TPLDEV_DSPEED_200NS            = $02;                            {  200ns card access time }
  107.     TPLDEV_DSPEED_150NS            = $03;                            {  150ns card access time }
  108.     TPLDEV_DSPEED_100NS            = $04;                            {  100ns card access time }
  109.     TPLDEV_EXTENDED_SPEED        = $07;                            {  device speed value for extended speed }
  110.     TPLDEV_SPEED_EXPONENT        = $07;                            {  extended byte exponent mask }
  111.     TPLDEV_SPEED_MANTISSA        = $78;                            {  extended byte mantissa mask }
  112.     TPLDEV_SPEED_EXTENDED_MASK    = $80;                            {  bit set if more extended speed data follows }
  113.  
  114. {     device ID types }
  115.     DTYPE_NULL                    = 0;
  116.     DTYPE_ROM                    = 1;
  117.     DTYPE_OTPROM                = 2;
  118.     DTYPE_EPROM                    = 3;
  119.     DTYPE_EEPROM                = 4;
  120.     DTYPE_FLASH                    = 5;
  121.     DTYPE_SRAM                    = 6;
  122.     DTYPE_DRAM                    = 7;
  123.     DTYPE_FUNCSPEC                = $0D;
  124.     DTYPE_EXTEND                = $0E;
  125.  
  126. { ---------------    Checksum Control Tuple (10H)    ---------------                             }
  127.  
  128. TYPE
  129.     ChecksumControlTuplePtr = ^ChecksumControlTuple;
  130.     ChecksumControlTuple = RECORD
  131.         TPLCKS_ADDR:            INTEGER;                                {  offset to region to be checksummed, LSB first }
  132.         TPLCKS_LEN:                INTEGER;                                {  length of region to be checksummed, LSB first }
  133.         TPLCKS_CS:                SInt8;                                    {  checksum of the region }
  134.         reserved:                SInt8;                                    {  padding }
  135.     END;
  136.  
  137. { ----------------    Long Link Multi-Function Tuple (06H)    ------                     }
  138.     LongLinkMFCTuplePtr = ^LongLinkMFCTuple;
  139.     LongLinkMFCTuple = PACKED RECORD
  140.         TPLMFC_NUM:                UInt8;                                    {  Number of sets of config registers for individual functions }
  141.         TPLMFC_TAS1:            UInt8;                                    {  CIS target address space for first function (00 = Attr, 01 = Common) }
  142.         TPLMFC_ADDR1:            UInt32;                                    {  Target address of first CIS, unsigned long, lsb first }
  143.         TPLMFC_TAS2:            UInt8;                                    {  CIS target address space for second function (00 = Attr, 01 = Common) }
  144.         TPLMFC_ADDR2:            PACKED ARRAY [0..3] OF UInt8;            {  [MISALIGNED!] Target address of second CIS, unsigned long, lsb first }
  145.                                                                         {  the following fields are of undetermined length and should be calculated at runtime }
  146.                                                                         {   }
  147.                                                                         {  UInt8        TPLMFC_TASn; }
  148.                                                                         {  UInt32        TPLMFC_ADDRn; }
  149.     END;
  150.  
  151. { ----------------    Long Link Tuple (11H, 12H)    ----------------                             }
  152.     LongLinkTuplePtr = ^LongLinkTuple;
  153.     LongLinkTuple = RECORD
  154.         TPLL_ADDR:                UInt32;                                    {  target address, LSB first }
  155.     END;
  156.  
  157. { -----------------    Link Target Tuple (13H)    ------------------                             }
  158.     LinkTargetTuplePtr = ^LinkTargetTuple;
  159.     LinkTargetTuple = RECORD
  160.         TPLL_TAG:                PACKED ARRAY [0..2] OF Byte;            {  tag: should be 'C', 'I', 'S' }
  161.     END;
  162.  
  163. { ----------------    Level 1 Version Tuple (15H)    ---------------                             }
  164.     Level1VersionTuplePtr = ^Level1VersionTuple;
  165.     Level1VersionTuple = RECORD
  166.         TPLLV1_MAJOR:            SInt8;                                    {  major version number (0x04) }
  167.         TPLLV1_MINOR:            SInt8;                                    {  minor version number (0x01 for release 2.0 and 2.01) }
  168.         TPLLV1_INFO:            SInt8;                                    {  product information string, zero-terminated }
  169.     END;
  170.  
  171. { -------------    JEDEC Identifier Tuple (18H, 19H)    ------------                             }
  172.     JEDECDeviceInfoPtr = ^JEDECDeviceInfo;
  173.     JEDECDeviceInfo = RECORD
  174.         manufacturerID:            SInt8;
  175.         manufacturerInfo:        SInt8;
  176.     END;
  177.  
  178.     JEDECIdentifierTuplePtr = ^JEDECIdentifierTuple;
  179.     JEDECIdentifierTuple = RECORD
  180.         device:                    ARRAY [0..0] OF JEDECDeviceInfo;
  181.     END;
  182.  
  183. { ---------    Configuration Tuple (1AH)    ----------                             }
  184.     ConfigTuplePtr = ^ConfigTuple;
  185.     ConfigTuple = RECORD
  186.         TPCC_SZ:                SInt8;                                    {  size of fields byte }
  187.         TPCC_LAST:                SInt8;                                    {  index number of last config entry }
  188.         TPCC_RADR:                SInt8;                                    {  config reg's base addr in reg. space }
  189.         reserved:                SInt8;                                    {  padding }
  190.                                                                         {  the following fields are of undetermined length and should be calculated at runtime }
  191.                                                                         { UInt32            TPCC_RMSK; }
  192.                                                                         { UInt32            TPCC_RSVD; }
  193.                                                                         { UInt32            TPCC_SBTPL; }
  194.     END;
  195.  
  196. {     TPCC_RADR field definitions }
  197.  
  198. CONST
  199.     TPCC_RASZ                    = $03;                            {  bits 1-0 }
  200.     TPCC_RMSZ                    = $3C;                            {  bits 5-2 }
  201.     TPCC_RFSZ                    = $C0;                            {  bits 7-6 }
  202.  
  203. { ---------    Device Geometry Tuple (1EH, 1FH)    ---------- }
  204.  
  205. TYPE
  206.     DeviceGeometryPtr = ^DeviceGeometry;
  207.     DeviceGeometry = RECORD
  208.         DGTPL_BUS:                SInt8;                                    {  system bus width = 2^(n-1), n>0 }
  209.         DGTPL_EBS:                SInt8;                                    {  erase block size = 2^(n-1), n>0 }
  210.         DGTPL_RBS:                SInt8;                                    {  read block size = 2^(n-1), n>0 }
  211.         DGTPL_WBS:                SInt8;                                    {  write block size = 2^(n-1), n>0 }
  212.         DGTPL_PART:                SInt8;                                    {  partitioning size = 2^(n-1), n>0 }
  213.         DGTPL_HWIL:                SInt8;                                    {  hardware interleave = 2^(n-1), n>0 }
  214.     END;
  215.  
  216.     DeviceGeometryTuplePtr = ^DeviceGeometryTuple;
  217.     DeviceGeometryTuple = RECORD
  218.         device:                    ARRAY [0..41] OF DeviceGeometry;
  219.     END;
  220.  
  221. { ---------    Manufacturer Identification Tuple (20H)    ----------                             }
  222.     ManufIDTuplePtr = ^ManufIDTuple;
  223.     ManufIDTuple = RECORD
  224.         TPLMID_MANF:            INTEGER;                                {  PCMCIA PC Card manufacturer code }
  225.         TPLMID_CARD:            INTEGER;                                {  manufacturer information (part number and/or revision) }
  226.     END;
  227.  
  228. { -----------    Function Identification Tuple (21H)    ------------                             }
  229.     FunctionIDTuplePtr = ^FunctionIDTuple;
  230.     FunctionIDTuple = RECORD
  231.         TPLFID_FUNCTION:        SInt8;                                    {  PC card function code }
  232.         TPLFID_SYSINIT:            SInt8;                                    {  system initialization bit mask }
  233.     END;
  234.  
  235. {     function codes }
  236.  
  237. CONST
  238.     TPLFID_MultiFunction        = 0;
  239.     TPLFID_Memory                = 1;
  240.     TPLFID_SerialPort            = 2;
  241.     TPLFID_ParallelPort            = 3;
  242.     TPLFID_FixedDisk            = 4;
  243.     TPLFID_VideoAdaptor            = 5;
  244.     TPLFID_NetworkLANAdaptor    = 6;
  245.     TPLFID_AIMS                    = 7;
  246.  
  247. { ------------    Software Interleave Tuple (23H)    ---------------                             }
  248.  
  249. TYPE
  250.     SoftwareInterleaveTuplePtr = ^SoftwareInterleaveTuple;
  251.     SoftwareInterleaveTuple = RECORD
  252.         TPLSWIL_INTRLV:            SInt8;                                    {  software interleave }
  253.     END;
  254.  
  255. { -------    Level 2 Version and Information Tuple (40H)    --------                             }
  256.     Level2VersionTuplePtr = ^Level2VersionTuple;
  257.     Level2VersionTuple = RECORD
  258.         TPLLV2_VERS:            SInt8;                                    {  structure version (0x00) }
  259.         TPLLV2_COMPLY:            SInt8;                                    {  level of compliance with the standard (0x00) }
  260.         TPLLV2_DINDEX:            UInt16;                                    {  byte address of first data byte in card, LSB first }
  261.         TPLLV2_RSV6:            SInt8;                                    {  reserved, must be zero }
  262.         TPLLV2_RSV7:            SInt8;                                    {  reserved, must be zero }
  263.         TPLLV2_VSPEC8:            SInt8;                                    {  vendor specific byte }
  264.         TPLLV2_VSPEC9:            SInt8;                                    {  vendor specific byte }
  265.         TPLLV2_NHDR:            SInt8;                                    {  number of copies of CIS present on this device }
  266.         TPLLV2_OEM:                SInt8;                                    {  vendor of software that formatted card, zero-terminated }
  267.         TPLLV2_INFO:            SInt8;                                    {  informational message about the card, zero-terminated }
  268.         reserved:                SInt8;                                    {  padding }
  269.     END;
  270.  
  271. {
  272. --------------------    Format Tuple (41H)    --------------------                            
  273.  additional information for disk type:
  274. }
  275.     FormatDiskTuplePtr = ^FormatDiskTuple;
  276.     FormatDiskTuple = RECORD
  277.         TPLFMT_BKSZ:            UInt16;                                    {     block size, or zero if unblocked format }
  278.         TPLFMT_NBLOCKS:            UInt32;                                    {     number of data blocks in this partition }
  279.         TPLFMT_EDCLOC:            UInt32;                                    {     location of error detection code, or zero if interleaved }
  280.     END;
  281.  
  282. {  additional information for disk type: }
  283.     FormatMemTuplePtr = ^FormatMemTuple;
  284.     FormatMemTuple = RECORD
  285.         TPLFMT_FLAGS:            SInt8;                                    {     various flags }
  286.         TPLFMT_RESERVED:        SInt8;                                    {     reserved, set to zero }
  287.         TPLFMT_ADDRESS:            UInt32;                                    {     physical location at which this memory partion must be mapped }
  288.         TPLFMT_EDCLOC:            UInt32;                                    {     location of error detection code, or zero if interleaved }
  289.     END;
  290.  
  291.     FormatTuplePtr = ^FormatTuple;
  292.     FormatTuple = RECORD
  293.         TPLFMT_TYPE:            SInt8;                                    {  format type code }
  294.         TPLFMT_EDC:                SInt8;                                    {  error detection method and length of error detection code }
  295.         TPLFMT_OFFSET:            LONGINT;                                {  offset to first data byte in this partition }
  296.         TPLFMT_NBYTES:            LONGINT;                                {  number of data bytes in this partition }
  297.         CASE INTEGER OF
  298.         0: (
  299.             TPLFMT_DISK:        FormatDiskTuple;
  300.             );
  301.         1: (
  302.             TPLFMT_MEM:            FormatMemTuple;
  303.             );
  304.     END;
  305.  
  306. {     format types }
  307.  
  308. CONST
  309.     TPLFMTTYPE_DISK                = 0;
  310.     TPLFMTTYPE_MEM                = 1;
  311.     TPLFMTTYPE_VS                = $80;
  312.  
  313. {     error detection types }
  314.     TPLFMTEDC_NONE                = 0;
  315.     TPLFMTEDC_CKSUM                = 1;
  316.     TPLFMTEDC_CRC                = 2;
  317.     TPLFMTEDC_PCC                = 3;
  318.     TPLFMTEDC_VS                = 8;
  319.  
  320. {     bits in TPLFMT_FLAGS }
  321.     TPLFMTFLAGS_ADDR            = 0;
  322.     TPLFMTFLAGS_AUTO            = 1;
  323.  
  324. { ------------------    Geometry Tuple (42H)    --------------------                             }
  325.  
  326. TYPE
  327.     GeometryTuplePtr = ^GeometryTuple;
  328.     GeometryTuple = RECORD
  329.         TPLGEO_SPT:                SInt8;                                    {  number of sectors per track }
  330.         TPLGEO_TPC:                SInt8;                                    {  number of tracks per cylinder }
  331.         TPLGEO_NCYL:            INTEGER;                                {  number of cylinders, total }
  332.     END;
  333.  
  334. { -----------------    Byte-Order Tuple (43H)    -------------------                             }
  335.     ByteOrderTuplePtr = ^ByteOrderTuple;
  336.     ByteOrderTuple = RECORD
  337.         TPLBYTE_ORDER:            SInt8;                                    {  byte order code }
  338.         TPLBYTE_MAP:            SInt8;                                    {  byte mapping code }
  339.     END;
  340.  
  341. {     byte order codes }
  342.  
  343. CONST
  344.     TYPBYTEORD_LOW                = 0;
  345.     TYPBYTEORD_HIGH                = 1;
  346.     TYPBYTEORD_VS                = $80;
  347.  
  348. {     byte mapping codes }
  349.     TYPBYTEMAP_LOW                = 0;
  350.     TYPBYTEMAP_HIGH                = 1;
  351.     TYPBYTEMAP_VS                = $80;
  352.  
  353. { ----------    Card Initialization Date Tuple (44H)    ------------                             }
  354.  
  355. TYPE
  356.     CardInitDateTuplePtr = ^CardInitDateTuple;
  357.     CardInitDateTuple = RECORD
  358.         TPLDATE_TIME:            UInt16;                                    {  hours, minutes, seconds }
  359.         TPLDATE_DAY:            UInt16;                                    {  year, month, day }
  360.     END;
  361.  
  362. { ----------    Battery-Replacement Date Tuple (45H)    ------------                             }
  363.     BatteryReplaceDateTuplePtr = ^BatteryReplaceDateTuple;
  364.     BatteryReplaceDateTuple = RECORD
  365.         TPLBATT_RDAY:            UInt16;                                    {  last replacement date (year, month, day) }
  366.         TPLBATT_XDAY:            UInt16;                                    {  battery expiration date (year, month, day) }
  367.     END;
  368.  
  369. { ----------------------    General Tuple    -----------------------                             }
  370.     TupleBodyPtr = ^TupleBody;
  371.     TupleBody = RECORD
  372.         CASE INTEGER OF
  373.         0: (
  374.             deviceID:            DeviceIDTuple;
  375.             );
  376.         1: (
  377.             checksum:            ChecksumControlTuple;
  378.             );
  379.         2: (
  380.             link:                LongLinkTuple;
  381.             );
  382.         3: (
  383.             target:                LinkTargetTuple;
  384.             );
  385.         4: (
  386.             level1:                Level1VersionTuple;
  387.             );
  388.         5: (
  389.             jedecID:            JEDECIdentifierTuple;
  390.             );
  391.         6: (
  392.             config:                ConfigTuple;
  393.             );
  394.         7: (
  395.             devGeo:                DeviceGeometryTuple;
  396.             );
  397.         8: (
  398.             manufID:            ManufIDTuple;
  399.             );
  400.         9: (
  401.             funcID:                FunctionIDTuple;
  402.             );
  403.         10: (
  404.             swil:                SoftwareInterleaveTuple;
  405.             );
  406.         11: (
  407.             level2:                Level2VersionTuple;
  408.             );
  409.         12: (
  410.             format:                FormatTuple;
  411.             );
  412.         13: (
  413.             geometry:            GeometryTuple;
  414.             );
  415.         14: (
  416.             order:                ByteOrderTuple;
  417.             );
  418.         15: (
  419.             initDate:            CardInitDateTuple;
  420.             );
  421.         16: (
  422.             battDate:            BatteryReplaceDateTuple;
  423.             );
  424.         17: (
  425.             tupleData:            PACKED ARRAY [0..253] OF Byte;
  426.             );
  427.     END;
  428.  
  429.     TuplePtr = ^Tuple;
  430.     Tuple = RECORD
  431.         TPL_CODE:                SInt8;
  432.         TPL_LINK:                SInt8;
  433.         TPL_BODY:                TupleBody;
  434.     END;
  435.  
  436. {$ALIGN RESET}
  437. {$POP}
  438.  
  439. {$SETC UsingIncludes := PCCardTuplesIncludes}
  440.  
  441. {$ENDC} {__PCCARDTUPLES__}
  442.  
  443. {$IFC NOT UsingIncludes}
  444.  END.
  445. {$ENDC}
  446.